package com.ssy.lingxi.common.model.vo;

import javax.validation.constraints.Positive;
import java.io.Serializable;

/**
 * 分页查询请求
 *
 * @author 万宁
 * @version 2.0.0
 * @date 2020-06-01
 */
public class PageVO implements Serializable {
    private static final long serialVersionUID = 2857050142049334121L;

    /**
     * 当前页
     */
    @Positive(message = "当前页必须大于0")
    private int current = 1;

    /**
     * 每页行数
     */
    @Positive(message = "每页行数必须大于0")
    private int pageSize = 10;

    public int getCurrent() {
        return current;
    }

    public int getCurrentOffset() {
        return current <= 1 ? 0 : (current - 1) * pageSize;
    }

    public void setCurrent(int current) {
        this.current = current;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
}
